The kill Command
The kill
command can be used to terminate running processes on Unix-like operating systems.
Syntax
The kill
command can be used to terminate running processes on Unix-like operating systems.
Syntax
The basic syntax for the kill
command is as follows:
kill [options] <signal> <process ID>
The <signal> argument is the signal that you want to send to the process. The <process ID> argument is the identifier of the process that you want to terminate.
Signals
There are a variety of different signals that you can send to a process. Some of the most common signals are:
- SIGTERM: Terminate the process.
- SIGINT: Interrupt the process.
- SIGKILL: Forcefully terminate the process.
For a complete list of signals, please see the man page for signal.
Examples
Terminate the process with the process ID 1234.
kill 1234
Send the SIGTERM
signal to the process with the process ID 1234.
kill -SIGTERM 1234
Forcefully terminate the process with the process ID 1234.
kill -SIGKILL 1234
For more information on the kill
command and its options, please see the man page: man kill
.
Safety guidelines
When using the kill
command, it is important to be careful not to terminate processes that are essential for the system to run. It is also important to be careful not to terminate processes that are being used by other users.
If you are unsure whether or not it is safe to terminate a process, you should consult with a system administrator.
With gencmd
gencmd list all processes
- ps
- ps -A
- ps -ef
gencmd kill process 1234
- kill -9 1234